﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using YFIN.Data;
using YFIN.Models;

namespace YFIN.Service.User
{
    [ServiceContract]
    public interface IUserService
    {
        /// <summary>
        /// 添加一个用户
        /// </summary>
        /// <param name="user">要添加的用户</param>
        [OperationContract]
        bool Add(ModelUser user);

        /// <summary>
        /// 通过用户名查找用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>找到的用户</returns>
        [OperationContract]
        ModelUser GetByUserName(string userName);

        /// <summary>
        /// 查找所有用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>找到所有用户</returns>
        [OperationContract]
        List<ModelUser> GetAll();

        /// <summary>
        /// 判读是否与给定用户名密码相匹配的用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>是否存在匹配</returns>
        [OperationContract]
        ModelUser Exist(string userName, string password);

        /// <summary>
        /// 获取用户文件路径
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>文件路径</returns>
        [OperationContract]
        string GetPath(string userName);

        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="newUser">更新后的用户</param>
        /// <returns>是否成功</returns>
        [OperationContract]
        bool Update(ModelUser newUser);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="user">要删除的用户</param>
        /// <returns>是否成功</returns>
        [OperationContract]
        bool Delete(ModelUser user);
    }
}
